﻿using System;
using System.Data;
using System.Reflection;
using System.Windows.Forms;

namespace QL_Truong_Hoc.Export
{
    public partial class frmExportExcel : DevExpress.XtraEditors.XtraForm
    {
        private const string mcstrRoleCode = "bao_cao";

        public DevExpress.XtraSpreadsheet.SpreadsheetControl XlsControl { get { return this.XlsBaoCao; } }

        private const string mcstrExportFail = "Tạo báo cáo thất bại. Xin hãy thử lại.";

        public frmExportExcel()
        {
            InitializeComponent();
        }
        
        private void frmExportExcel_Load(object sender, EventArgs e)
        {
            if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode))
            {
                this.BeginInvoke(new MethodInvoker(this.Close));
                return;
            }
        }

        /// <summary>
        /// Xuất danh sách lớp nghề
        /// </summary>
        /// <param name="intLopID"></param>
        /// <returns></returns>
        public bool fncExportDanhSachLopNghe(int intLopID)
        {
            bool blnResult = false;
            DataTable objData = null;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode, false))
                {
                    return false;
                }

                clsDSLopNghe objExport;

                objExport = new clsDSLopNghe();
                objData = DAO.clsDbAccess.fncGetDanhSachLopNghe(Program.gobjDb, intLopID);

                if (!objExport.fncExport(this.XlsBaoCao, objData, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                this.Text = "Danh sách lớp nghề";
                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        /// <summary>
        /// Xuất danh sách lớp văn hóa
        /// </summary>
        /// <param name="intLopID"></param>
        /// <returns></returns>
        public bool fncExportDanhSachLopVanHoa(int intLopID)
        {
            bool blnResult = false;
            DataTable objData = null;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode))
                {
                    return false;
                }

                clsDSLopVanHoa objExport;

                objExport = new clsDSLopVanHoa();
                objData = DAO.clsDbAccess.fncGetDanhSachLopVanHoa(Program.gobjDb, intLopID);

                if (!objExport.fncExport(this.XlsBaoCao, objData, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                this.Text = "Danh sách lớp văn hóa";
                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        /// <summary>
        /// Xuất điểm môn văn hóa
        /// </summary>
        /// <param name="intLopID"></param>
        /// <param name="intMonID"></param>
        /// <returns></returns>
        public bool fncExportDiemMonVanHoa(int intLopID, int intMonID)
        {
            bool blnResult = false;
            DataTable objData = null;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode))
                {
                    return false;
                }

                clsDiemVanHoa objExport;

                objExport = new clsDiemVanHoa();
                objData = DAO.clsDbAccess.fncGetDiemVanHoa(Program.gobjDb, intLopID, intMonID);

                if (!objExport.fncExport(this.XlsBaoCao, objData, (clsEnum.MON_VAN_HOA)intMonID, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                switch (intMonID)
                {
                    case (int)clsEnum.MON_VAN_HOA.TOAN:
                        this.Text = "Danh sách điểm môn Toán";
                        break;

                    case (int)clsEnum.MON_VAN_HOA.LY:
                        this.Text = "Danh sách điểm môn Lý";
                        break;

                    case (int)clsEnum.MON_VAN_HOA.HOA:
                        this.Text = "Danh sách điểm môn Hóa";
                        break;

                    case (int)clsEnum.MON_VAN_HOA.VAN:
                        this.Text = "Danh sách điểm môn Văn";
                        break;
                }

                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        /// <summary>
        /// Xuất điểm môn văn hóa 4 môn tổng hợp
        /// </summary>
        /// <param name="intLopID"></param>
        /// <param name="intMonID"></param>
        /// <returns></returns>
        public bool fncExportDiemMonVanHoa4Mon(int intLopID)
        {
            bool blnResult = false;
            DataTable objData = null;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode))
                {
                    return false;
                }

                clsDiemVanHoa4Mon objExport = new clsDiemVanHoa4Mon();

                //xuất điểm toán
                objData = DAO.clsDbAccess.fncGetDiemVanHoa(Program.gobjDb, intLopID, (int)clsEnum.MON_VAN_HOA.TOAN);
                if (!objExport.fncExport(this.XlsBaoCao, objData, clsEnum.MON_VAN_HOA.TOAN, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                //xuất điểm lý
                objData = DAO.clsDbAccess.fncGetDiemVanHoa(Program.gobjDb, intLopID, (int)clsEnum.MON_VAN_HOA.LY);
                if (!objExport.fncExport(this.XlsBaoCao, objData, clsEnum.MON_VAN_HOA.LY, true))
                    //if (!objExport.fncExport(this.XlsBaoCao, objData, clsEnum.MON_VAN_HOA.LY, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                //xuất điểm hóa
                objData = DAO.clsDbAccess.fncGetDiemVanHoa(Program.gobjDb, intLopID, (int)clsEnum.MON_VAN_HOA.HOA);
                if (!objExport.fncExport(this.XlsBaoCao, objData, clsEnum.MON_VAN_HOA.HOA, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                //xuất điểm văn
                objData = DAO.clsDbAccess.fncGetDiemVanHoa(Program.gobjDb, intLopID, (int)clsEnum.MON_VAN_HOA.VAN);
                if (!objExport.fncExport(this.XlsBaoCao, objData, clsEnum.MON_VAN_HOA.VAN, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }


                this.Text = "Danh sách điểm tổng hợp 4 môn văn hóa";

                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        /// <summary>
        /// Xuất điểm môn nghề
        /// </summary>
        /// <param name="intLopID"></param>
        /// <param name="intMonID"></param>
        /// <returns></returns>
        public bool fncExportDiemMonNghe(int intLopID, int intMonID)
        {
            bool blnResult = false;
            DataTable objData = null;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode))
                {
                    return false;
                }

                clsDiemNghe objExport;

                objExport = new clsDiemNghe();
                objData = DAO.clsDbAccess.fncGetDiemNghe(Program.gobjDb, intLopID, intMonID);

                if (!objExport.fncExport(this.XlsBaoCao, objData, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        /// <summary>
        /// Xuất danh sách thi hết môn nghề
        /// </summary>
        /// <param name="stOption"></param>
        /// <param name="objData"></param>
        /// <returns></returns>
        public bool fncExportDanhSachThiHetMonNghe(clsDSKiemTraKetThucMonNghe.stSetting stOption, DataTable objData)
        {
            bool blnResult = false;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode))
                {
                    return false;
                }

                clsDSKiemTraKetThucMonNghe objExport;

                objExport = new clsDSKiemTraKetThucMonNghe();

                if (!objExport.fncExport(this.XlsBaoCao, stOption, objData, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                this.Text = string.Format("Danh sách kiểm tra kết thúc môn {0} lớp {1}", stOption.strMon, stOption.strLop);

                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        /// <summary>
        /// Xuất danh sách thi tn nghề
        /// </summary>
        /// <param name="intTTN_ID"></param>
        /// <returns></returns>
        public bool fncExportDanhSachThiTotNghiep(int intTTN_ID, int intTrinhDo)
        {
            bool blnResult = false;
            DataTable objData = null;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode))
                {
                    return false;
                }

                clsDSThiTotNghiepSC objExportSC;
                clsDSThiTotNghiepCD objExportCD;

                objExportSC = new clsDSThiTotNghiepSC();
                objExportCD = new clsDSThiTotNghiepCD();

                objData = DAO.clsDbAccess.fncGetDsThiTotNghiepNghe(Program.gobjDb, intTTN_ID);

                if (intTrinhDo == (int)clsEnum.TRINH_DO_DAO_TAO.SO_CAP)
                {
                    if (!objExportSC.fncExport(this.XlsBaoCao, objData, true))
                    {
                        clsCommon.fncMsgError(mcstrExportFail);
                        return false;
                    }
                }
                else
                {
                    if (!objExportCD.fncExport(this.XlsBaoCao, objData, true))
                    {
                        clsCommon.fncMsgError(mcstrExportFail);
                        return false;
                    }
                }

                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        /// <summary>
        /// Xuất danh sách thi tn nghề
        /// </summary>
        /// <param name="intTTN_ID"></param>
        /// <returns></returns>
        public bool fncExportDanhSachThiTotNghiepVanHoa_KetQua(DataTable objData)
        {
            bool blnResult = false;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode))
                {
                    return false;
                }

                clsDSThiTotNghiepVanHoa_KetQua objExportVHKQ;
                objExportVHKQ = new clsDSThiTotNghiepVanHoa_KetQua();

                if (!objExportVHKQ.fncExport(this.XlsBaoCao, objData, true))
                {
                    clsCommon.fncMsgError(mcstrExportFail);
                    return false;
                }

                this.Text = "Danh sách kiểm tra kết thúc môn học văn hóa";

                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        #region Dành cho phân cụm


        public bool fncExportPhanCum(string strTenKhoas, string strTenNghe, int intKDT, int intTrinhDoDT, int intLopID)
        {
            bool blnResult = false;
            DataTable objData = null;

            try
            {
                if (!clsCommon.fncCheckRole(Program.glstRoles, mcstrRoleCode, false))
                {
                    return false;
                }

                string strTemplate = Environment.CurrentDirectory + @"\Templates\Tong ket theo lop TC.xls";
                int intSoBanGhi = 0;
                int intSoMonHoc = 0;
                string strTrinhDo;

                this.Text = "Dữ liệu phân cụm";

                objData = DAO.clsDbAccess.fncGetTongKetTC2(Program.gobjDb, intKDT, intLopID);
                if (objData == null) return true;

                if (!System.IO.File.Exists(strTemplate))
                {
                    clsCommon.fncMsgWarning("Không tìm thấy tệp tin mẫu.");
                    return true;
                }
                XlsBaoCao.LoadDocument(strTemplate);

                if (intTrinhDoDT == (int)clsEnum.TRINH_DO_DAO_TAO.SO_CAP) strTrinhDo = "SC";
                else if (intTrinhDoDT == (int)clsEnum.TRINH_DO_DAO_TAO.TRUNG_CAP) strTrinhDo = "TC";
                else strTrinhDo = "CD";

                intSoBanGhi = objData.Rows.Count;
                if(objData.Columns.Count <= 28) {intSoMonHoc = 3;}
                else{
                if (intTrinhDoDT == (int)clsEnum.TRINH_DO_DAO_TAO.TRUNG_CAP) intSoMonHoc = objData.Columns.Count - 25;
                }

                //tạo n dong moi.
                if (intSoBanGhi > 2)
                {
                    XlsBaoCao.ActiveWorksheet.Rows.Insert(4, intSoBanGhi - 2);

                    //(12 + intSoBanGhi - 2) -> bắt đầu tính từ dòng 12 + (Số bản ghi - 1 là 2 dòng đầu tiên bị nhảy qua + 1 dòng cuối ko copy format)
                    XlsBaoCao.ActiveWorksheet.Range["A5:Y" + (4 + intSoBanGhi - 2)].CopyFrom(XlsBaoCao.ActiveWorksheet.Range["A4:Y4"]);
                    XlsBaoCao.ActiveWorksheet.Range["A5:Y" + (4 + intSoBanGhi - 2)].Style = XlsBaoCao.ActiveWorksheet.Range["A4:Y4"].Style;
                }

                if (intSoMonHoc > 3)
                {
                    XlsBaoCao.ActiveWorksheet.Columns.Insert(13, intSoMonHoc - 3);
                    XlsBaoCao.ActiveWorksheet.Range["N2:" + GetExcelColumnName(13 + intSoMonHoc - 3) + (3 + intSoBanGhi)].CopyFrom(XlsBaoCao.ActiveWorksheet.Range["M2:M" + (3 + intSoBanGhi)]);
                    XlsBaoCao.ActiveWorksheet.Range["N2:" + GetExcelColumnName(13 + intSoMonHoc - 3) + (3 + intSoBanGhi)].Style = XlsBaoCao.ActiveWorksheet.Range["M2:M" + (3 + intSoBanGhi)].Style;                    
                }
                
                string strHoDem;
                string strTen;
                DateTime dtNgaySinh;
                string strDiaDanh;
                bool blnDaKhaoSat;

                bool blnLaBoDoi;
                string strUuTien;
                string strVanHoa;

                float fltDiemToanKhoa;
                float fltDiemChinhTri;
                float fltDiemLyThuyet;
                float fltDiemThucHanh;
                float fltDiemDanhGiaTN;
                string strXepLoaiTN;
                int intDiemRenLuyen;
                string strXepLoaiRL;
                bool blnDaCoViec;

                float fltDiemMonHoc;
                string strTenMonHoc;

                int intCurrentRow = 3;
                int intCurrentCol = 0;
                bool blnFirstRun = true;
                const string cstrFloatFormat = "0.0";

                for (int i = 0; i <= objData.Rows.Count - 1; i++)
                {
                    //lay data
                    strHoDem = clsCommon.fncCnvNullToString(objData.Rows[i]["Họ đệm"]);
                    strTen = clsCommon.fncCnvNullToString(objData.Rows[i]["Tên"]);
                    dtNgaySinh = clsCommon.fncCnvNullToDatetime(objData.Rows[i]["Ngày sinh"]);
                    strDiaDanh = clsCommon.fncCnvNullToString(objData.Rows[i]["DD_ID"]);
                    blnDaKhaoSat = clsCommon.fncCnvNullToBool(objData.Rows[i]["hs_khaosattruockhihoc"]);

                    blnLaBoDoi = clsCommon.fncCnvNullToBool(objData.Rows[i]["TheHocNghe"]);
                    strUuTien = clsCommon.fncCnvNullToString(objData.Rows[i]["hs_uutien"]);
                    strVanHoa = clsCommon.fncCnvNullToString(objData.Rows[i]["tdvh_ten"]);

                    if(intTrinhDoDT == (int)clsEnum.TRINH_DO_DAO_TAO.SO_CAP)
                        fltDiemToanKhoa = clsCommon.fncCnvNullToFloat(objData.Rows[i]["Điểm KTKT"]);
                    else
                        fltDiemToanKhoa = clsCommon.fncCnvNullToFloat(objData.Rows[i]["Điểm TB toàn khóa"]);

                    fltDiemChinhTri = clsCommon.fncCnvNullToFloat(objData.Rows[i]["Thi Chính trị"]);
                    fltDiemLyThuyet = clsCommon.fncCnvNullToFloat(objData.Rows[i]["Thi Lý thuyết"]);
                    fltDiemThucHanh = clsCommon.fncCnvNullToFloat(objData.Rows[i]["Thi Thực hành"]);
                    fltDiemDanhGiaTN = clsCommon.fncCnvNullToFloat(objData.Rows[i]["Điểm đánh giá tốt nghiệp"]);
                    strXepLoaiTN = clsCommon.fncCnvNullToString(objData.Rows[i]["Xếp loại tốt nghiệp"]);
                    intDiemRenLuyen = clsCommon.fncCnvNullToInt(objData.Rows[i]["Điểm rèn luyện"]);
                    strXepLoaiRL = clsCommon.fncCnvNullToString(objData.Rows[i]["Xếp loại rèn luyện"]);
                    blnDaCoViec = clsCommon.fncCnvNullToBool(objData.Rows[i]["hs_coviecsautotnghiep"]);

                    //set cell
                    intCurrentCol = 0; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = i + 1;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strHoDem;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strTen;
                    intCurrentCol++; if (dtNgaySinh > DateTime.MinValue) XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = dtNgaySinh.ToString("dd/MM/yyyy");
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strDiaDanh;
                    intCurrentCol++;
                    if (blnDaKhaoSat) XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = "Đăng ký học nghề";
                    else XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = "Không đăng ký";

                    intCurrentCol++;
                    if (blnLaBoDoi) XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = "BĐXN";
                    else XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = "Dân sự";

                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strUuTien;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strVanHoa;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strTenKhoas;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strTrinhDo;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strTenNghe;

                    intCurrentCol = intCurrentCol + intSoMonHoc;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = fltDiemToanKhoa.ToString(cstrFloatFormat);
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = fltDiemChinhTri.ToString(cstrFloatFormat);
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = fltDiemLyThuyet.ToString(cstrFloatFormat);
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = fltDiemThucHanh.ToString(cstrFloatFormat);
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = fltDiemDanhGiaTN.ToString(cstrFloatFormat);
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strXepLoaiTN;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = intDiemRenLuyen;
                    intCurrentCol++; XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = strXepLoaiRL;

                    intCurrentCol++;
                    if (blnDaCoViec) XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = "Có việc làm ";
                    else XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = "Chưa có việc làm";

                    intCurrentCol = 11;
                    for (int j = 25; j <= objData.Columns.Count - 1; j++) //bat dau tu 25 vi co 25 cot dau tien la fix, tu cot 25 tro di la mon hoc
                    {
                        intCurrentCol++;
                        if (blnFirstRun) {
                            strTenMonHoc = clsCommon.fncCnvNullToString(objData.Columns[j].ColumnName);
                            
                            //fill header va merge cell
                            XlsBaoCao.ActiveWorksheet.Cells[1, intCurrentCol].Value = strTenMonHoc;
                            XlsBaoCao.ActiveWorksheet.MergeCells(XlsBaoCao.ActiveWorksheet.Range[GetExcelColumnName(intCurrentCol) + "2:" + GetExcelColumnName(intCurrentCol) + "3"]);
                        }

                        fltDiemMonHoc = clsCommon.fncCnvNullToFloat(objData.Rows[i][j]);
                        XlsBaoCao.ActiveWorksheet.Cells[intCurrentRow, intCurrentCol].Value = fltDiemMonHoc.ToString(cstrFloatFormat);
                    }

                    blnFirstRun = false;
                    intCurrentRow++;
                }

                return true;
            }
            catch (Exception ex)
            { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally
            { if (objData != null) objData.Dispose(); }
            return blnResult;
        }

        private string GetExcelColumnName(int columnNumber)
        {
            int dividend = columnNumber;
            string columnName = String.Empty;
            int modulo;

            while (dividend > 0)
            {
                modulo = (dividend - 1) % 26;
                columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
                dividend = (int)((dividend - modulo) / 26);
            }

            return columnName;
        }

        #endregion
    }
}